set(
        INDEXER_SOURCES
        ../../clp/aws/AwsAuthenticationSigner.cpp
        ../../clp/aws/AwsAuthenticationSigner.hpp
        ../../clp/BoundedReader.cpp
        ../../clp/BoundedReader.hpp
        ../../clp/BufferedReader.cpp
        ../../clp/BufferedReader.hpp
        ../../clp/BufferReader.cpp
        ../../clp/BufferReader.hpp
        ../../clp/CurlDownloadHandler.cpp
        ../../clp/CurlDownloadHandler.hpp
        ../../clp/CurlEasyHandle.hpp
        ../../clp/CurlGlobalInstance.cpp
        ../../clp/CurlGlobalInstance.hpp
        ../../clp/CurlOperationFailed.hpp
        ../../clp/CurlStringList.hpp
        ../../clp/database_utils.cpp
        ../../clp/database_utils.hpp
        ../../clp/Defs.h
        ../../clp/EncodedVariableInterpreter.cpp
        ../../clp/EncodedVariableInterpreter.hpp
        ../../clp/ErrorCode.hpp
        ../../clp/ffi/EncodedTextAst.hpp
        ../../clp/ffi/EncodedTextAstError.cpp
        ../../clp/ffi/EncodedTextAstError.hpp
        ../../clp/ffi/encoding_methods.cpp
        ../../clp/ffi/encoding_methods.hpp
        ../../clp/ffi/encoding_methods.inc
        ../../clp/ffi/ir_stream/byteswap.hpp
        ../../clp/ffi/ir_stream/decoding_methods.cpp
        ../../clp/ffi/ir_stream/decoding_methods.hpp
        ../../clp/ffi/ir_stream/decoding_methods.inc
        ../../clp/ffi/ir_stream/protocol_constants.hpp
        ../../clp/ffi/ir_stream/utils.cpp
        ../../clp/ffi/ir_stream/utils.hpp
        ../../clp/ffi/SchemaTree.cpp
        ../../clp/ffi/SchemaTree.hpp
        ../../clp/ffi/StringBlob.hpp
        ../../clp/FileReader.cpp
        ../../clp/FileReader.hpp
        ../../clp/GlobalMetadataDBConfig.cpp
        ../../clp/GlobalMetadataDBConfig.hpp
        ../../clp/hash_utils.cpp
        ../../clp/hash_utils.hpp
        ../../clp/ir/constants.hpp
        ../../clp/ir/EncodedTextAst.cpp
        ../../clp/ir/EncodedTextAst.hpp
        ../../clp/ir/LogEvent.hpp
        ../../clp/ir/parsing.cpp
        ../../clp/ir/parsing.hpp
        ../../clp/ir/parsing.inc
        ../../clp/ir/types.hpp
        ../../clp/LogTypeDictionaryEntryReq.hpp
        ../../clp/MySQLDB.cpp
        ../../clp/MySQLDB.hpp
        ../../clp/MySQLParamBindings.cpp
        ../../clp/MySQLParamBindings.hpp
        ../../clp/MySQLPreparedStatement.cpp
        ../../clp/MySQLPreparedStatement.hpp
        ../../clp/NetworkReader.cpp
        ../../clp/NetworkReader.hpp
        ../../clp/Query.cpp
        ../../clp/Query.hpp
        ../../clp/ReaderInterface.cpp
        ../../clp/ReaderInterface.hpp
        ../../clp/streaming_compression/Constants.hpp
        ../../clp/streaming_compression/Decompressor.hpp
        ../../clp/streaming_compression/zstd/Decompressor.cpp
        ../../clp/streaming_compression/zstd/Decompressor.hpp
        ../../clp/Thread.cpp
        ../../clp/Thread.hpp
        ../../clp/time_types.hpp
        ../../clp/TraceableException.hpp
        ../../clp/type_utils.hpp
        ../../clp/VariableDictionaryEntryReq.hpp
        ../../clp/VariableDictionaryReaderReq.hpp
        ../../clp/VariableDictionaryWriterReq.hpp
        ../archive_constants.hpp
        ../ArchiveReader.cpp
        ../ArchiveReader.hpp
        ../ArchiveReaderAdaptor.cpp
        ../ArchiveReaderAdaptor.hpp
        ../ColumnReader.cpp
        ../ColumnReader.hpp
        ../DictionaryReader.hpp
        ../DictionaryEntry.cpp
        ../DictionaryEntry.hpp
        ../FileReader.cpp
        ../FileReader.hpp
        ../FileWriter.cpp
        ../FileWriter.hpp
        ../InputConfig.cpp
        ../InputConfig.hpp
        ../PackedStreamReader.cpp
        ../PackedStreamReader.hpp
        ../ReaderUtils.cpp
        ../ReaderUtils.hpp
        ../SchemaReader.cpp
        ../SchemaReader.hpp
        ../SchemaTree.cpp
        ../SchemaTree.hpp
        ../search/ast/SearchUtils.cpp
        ../search/ast/SearchUtils.hpp
        ../TimestampDictionaryReader.cpp
        ../TimestampDictionaryReader.hpp
        ../TimestampEntry.cpp
        ../TimestampEntry.hpp
        ../TimestampPattern.cpp
        ../TimestampPattern.hpp
        ../Utils.cpp
        ../Utils.hpp
        ../ZstdCompressor.cpp
        ../ZstdCompressor.hpp
        ../ZstdDecompressor.cpp
        ../ZstdDecompressor.hpp
        CommandLineArguments.cpp
        CommandLineArguments.hpp
        indexer.cpp
        IndexManager.cpp
        IndexManager.hpp
        MySQLIndexStorage.cpp
        MySQLIndexStorage.hpp
)

if(CLP_BUILD_EXECUTABLES)
        add_executable(indexer ${INDEXER_SOURCES})
        target_compile_features(indexer PRIVATE cxx_std_20)
        target_link_libraries(indexer
                PRIVATE
                absl::flat_hash_map
                Boost::iostreams Boost::program_options Boost::url
                ${CURL_LIBRARIES}
                clp::string_utils
                date::date
                MariaDBClient::MariaDBClient
                msgpack-cxx
                nlohmann_json::nlohmann_json
                OpenSSL::Crypto
                simdjson::simdjson
                spdlog::spdlog
                ystdlib::containers
                ystdlib::error_handling
                ${zstd_TARGET}
        )
        # Put the built executable at the root of the build directory
        set_target_properties(
                indexer
                PROPERTIES
                RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
        )
endif()
